<!-- **i18n版本-->
<template>
  <el-dialog :close-on-click-modal="false" :visible.sync="showDialog" :title="title" width="75%">
    <el-form ref="form" :model="form" size="small" label-width="120px">
      <el-row :gutter="10">
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--应用ID -->
          <el-form-item :label="tf('appId')" prop="appId">
            <el-input v-model="form.appId" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--编码 -->
          <el-form-item :label="tf('charset')" prop="charset">
            <Dictionary v-model="form.charset" :updata-dict="form.charset" :dict-key="'charset'" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--类型  -->
          <el-form-item :label="tf('format')" prop="format">
            <Dictionary v-model="form.format" :updata-dict="form.format" :dict-key="'responseType'" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--网关地址 -->
          <el-form-item :label="tf('gatewayUrl')" prop="gatewayUrl">
            <el-input v-model="form.gatewayUrl" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--异步回调 -->
          <el-form-item :label="tf('notifyUrl')" prop="notifyUrl">
            <el-input v-model="form.notifyUrl" :rows="3" type="textarea" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--私钥 -->
          <el-form-item :label="tf('privateKey')" prop="privateKey">
            <el-input v-model="form.privateKey" :rows="3" type="textarea" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--公钥 -->
          <el-form-item :label="tf('publicKey')" prop="publicKey">
            <el-input v-model="form.publicKey" :rows="3" type="textarea" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--回调地址 -->
          <el-form-item :label="tf('returnUrl')" prop="returnUrl">
            <el-input v-model="form.returnUrl" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--签名方式 -->
          <el-form-item :label="tf('signType')" prop="signType">
            <el-input v-model="form.signType" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--商户号 -->
          <el-form-item :label="tf('sysServiceProviderId')" prop="sysServiceProviderId">
            <el-input v-model="form.sysServiceProviderId" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--updateBy -->
          <el-form-item :label="tf('updateBy')">
            <el-input v-model="form.updateBy" />
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="20" :md="6" :lg="6" :xl="6">
          <!--updateTime -->
          <el-form-item :label="tf('updateTime')">
            <el-input v-model="form.updateTime" />
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <div slot="footer" class="dialog-footer">
      <el-button type="primary" @click="close()">{{ $t('btn.close') }}</el-button>
    </div>
  </el-dialog>
</template>

<script>
import { preview } from '@/api/alipayConfig'
import Dictionary from '@/components/Dictionary/index'
import i18nHandler from '@/mixins/i18nHandler'

export default {
  name: 'AlipayConfigDetail',
  components: {
    Dictionary,
  },
  mixins: [i18nHandler],
  props: {
    module: String,
  },
  data() {
    return {
      showDialog: false,
      title: '',
      dictionarys: [],
      form: {},
      i18nQry: {},
    }
  },
  created() {
    this.i18nQry.module = this.module
  },
  methods: {
    close() {
      this.showDialog = false
      this.form = {}
    },

    init() {
      preview({ id: this.form.id, accessKey: this.form.accessKey })
        .then((data) => {
          this.form = data.data
        })
        .catch(() => {})
    },
  },
}
</script>

<style scoped></style>
